

package cn.shengchao.examstar.pay.infrastructure.dao;

import cn.shengchao.base.anotation.DistributeDataPermission;
import cn.shengchao.base.enums.DistributeDataScopeEnum;
import cn.shengchao.examstar.rpc.orders.req.*;
import cn.shengchao.examstar.rpc.orders.res.OrderCountInfo;
import cn.shengchao.examstar.rpc.orders.res.OrderItemInfo;
import cn.shengchao.examstar.rpc.orders.res.OrderList;
import cn.shengchao.examstar.pay.infrastructure.dao.po.PayOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface OrderDao extends BaseMapper<PayOrder> {
    @DistributeDataPermission(dataScope = DistributeDataScopeEnum.SALE_USER_ORDER, distributeType = "2",orderTableAlias="a")
    List<OrderList> getOrderList(@Param("query") OrderQueryPage orderQueryPage);
    List<OrderList> getOrderImgList(@Param("orderIds")List<Long> orderIds);
    List<OrderItemInfo> queryOrderItemList(String orderId);

    @DistributeDataPermission(dataScope = DistributeDataScopeEnum.SALE_USER_ORDER, distributeType = "2",orderTableAlias="po")
    OrderCountInfo countUserPay(Long userId);

    List<OrderWithSupplierView> selectOrderViewListByPageQuery(@Param("query") OrderWithSupplierPageQuery orderWithSupplierPageQuery);

    BigDecimal countOrderViewAmountByPageQuery(@Param("query")OrderWithSupplierPageQuery orderWithSupplierPageQuery);

    List<SubOrderWithSupplierView> selectSubOrderViewListByPageQuery(@Param("query")SubOrderWithSupplierPageQuery subOrderWithSupplierPageQuery);

    Map<String,BigDecimal> countSubOrderViewAmountByPageQuery(@Param("query")SubOrderWithSupplierPageQuery subOrderWithSupplierPageQuery);
    Map<String,BigDecimal> countSubOrderViewDistributeAmountByPageQuery(@Param("query")SubOrderWithSupplierPageQuery subOrderWithSupplierPageQuery);

    Integer countOrderByOrderId(String orderId);

    List<SubOrderWithSupplierView> querySubOrderListById(Long orderId);

    List<SubOrderWithSupplierView> selectSubOrderListFromMainOrder(@Param("query")SubOrderForMainPageQuery subOrderForMainPageQuery);
}
